import Operation.IoOperation;
import book.Bookshelf;
import user.User;
import user.librarian;
import user.normal;

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static User login() {
        System.out.println("欢迎来到图书系统!");
        System.out.println("请输入你的姓名：");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        System.out.println("请选择身份: 1—管理员   2——普通用户");
        int choice = scanner.nextInt();
        if (choice == 1){
            return new librarian(name);
        }
        else {
            return new normal(name);
        }
    }

    public static void main(String[] args) {
        System.out.println("Halle！！");
        User user = login();
        Bookshelf bookshelf = new Bookshelf();

        while (true){
            int choice = user.menu();
            user.DoOperation(choice,bookshelf);
        }

    }
}